# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=python-wincertstore
_pkgname=wincertstore
pkgver=0.2.1
pkgrel=7
pkgdesc="Python module to extract CA and CRL certs from Windows' cert store (ctypes based)."
arch=('any')
url='https://pypi.org/project/wincertstore/#files'
license=('PSF')
depends=('python')
makedepends=('python-pip' 'python-build' 'python-wheel')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.zip"
        'setup.py.patch')
sha512sums=('e4c59a9d3ae953ebd2a5db92c037c2a444a90da08a4bf4bb7ee076deeaf5376e14a5f2ae5638f753ad77f64dab6108de8b4104d287ed15b1619142d2292f8e73'
            'ec746049cca3269c4ab70b2402c661b325b6f437021ff02e5a06f6d71496272ec4561557f2645b279920d51e352b0bda3e2ce4238d6d6ab8b9feb8cca6dc0351')

prepare() {
  cd "$_pkgname-$pkgver"

  patch -p0 < ../setup.py.patch
}

build() {
  cd "$_pkgname-$pkgver"

  python -m build --wheel --outdir="$startdir/dist"
}

package() {
  cd "$_pkgname-$pkgver"

  pip install \
    --verbose \
    --disable-pip-version-check \
    --no-warn-script-location \
    --ignore-installed \
    --no-compile \
    --no-deps \
    --root="$pkgdir" \
    --prefix=/usr \
    --no-index \
    --find-links="file://$startdir/dist" \
    $_pkgname
}

